<template>
	<view class="main" :style="{backgroundImage: 'url('+staticFileUrl+'/image/operation-stats/background-img.png)'}">
		<view class="header" id="header">
			<u-navbar :title="title" @leftClick="leftClick" bgColor="transparent" :titleStyle="titleStyle"
				:leftIconColor="leftIconColor" placeholder="true" />
			<u-notice-bar text="【合利宝】渠道通知：商户在节假日结算时会额外扣除万分之二结算手续费。对账请打开https://admin.iotbox.cn后台，移步到财务管理的结算查询功能"
				color="rgb(255, 255, 255)" bgColor="rgba(0, 0, 0, 0.1)">
			</u-notice-bar>
			<u-tabs :list="statsList" lineColor="rgb(255,255,255)" :scrollable="false" inactiveStyle="color:#FFFFFF;"
				activeStyle="color:#FFFFFF;"
				itemStyle="padding-left: 20px; padding-right: 20px; height: 45px;color:#FFFFFF;" lineHeight="4"
				@click="clickCurrent()" :current="current">
			</u-tabs>
			<view style="display: flex;justify-content: space-around;margin-top: 20rpx;padding: 0 20rpx;">
				<view :class="selectDayType == 0 ? 'select-item' : 'no-select-item'" @click="changeDayType(0)">
					今天
				</view>
				<view :class="selectDayType == 1 ? 'select-item' : 'no-select-item'" @click="changeDayType(1)">
					昨天
				</view>
				<!-- <view :class="selectDayType == 2 ? 'select-item' : 'no-select-item'" @click="changeDayType(2)">
					本周
				</view> -->
				<view :class="selectDayType == 3 ? 'select-item' : 'no-select-item'" @click="changeDayType(3)">
					本月
				</view>
				<view :class="selectDayType == 4 ? 'select-item' : 'no-select-item'" @click="changeDayType(4)">
					上月
				</view>
				<view :class="selectDayType == 5 ? 'select-item' : 'no-select-item'" @click="changeDayType(5)">
					今年
				</view>
				<view class="custom" @click="selectTime(-1)" :class="selectDayType == -1 ? 'custom-select' : 'custom'">
					<view class="u-p-l-15">自定义</view>
					<view class="u-p-r-15" v-if="selectDayType == -1">
						<u-icon name="arrow-right" size="13px" color="rgb(96, 114, 255)"></u-icon>
					</view>
					<view class="u-p-r-15" v-else>
						<u-icon name="arrow-right" size="13px" color="#fff"></u-icon>
					</view>
				</view>
			</view>
			<view class="filter-criteria-box">
				<view class="filter-criteria" @click="showSelectStore()">
					<view v-if="selectMchStoreId == -1">
						全部场地（{{totalMerchantStore}}个）
					</view>
					<view v-else>
						{{selectMchStoreName}}
					</view>
					<u-icon name="arrow-down-fill" color="#FFFFFF" size="12"></u-icon>
				</view>
				<view class="filter-criteria" @click="showSelectDeviceType()" v-if="current < 2">
					<view v-if="selectDeviceTypeId == -1" style="margin-right: 8rpx;">
						全部设备类型（{{userStatistics.totalDevice}}）台
					</view>
					<view v-else>
						{{selectDeviceTypeName}}({{userStatistics.totalDevice}})
					</view>
					<u-icon name="arrow-down-fill" color="#FFFFFF" size="12"></u-icon>
				</view>
			</view>
			<u-calendar :show="showTime" @confirm="confirmTime()" @cancel="cancelTime()" closeOnClickOverlay="true"
				@close="closeTime()" :minDate="timesTempMin" :maxDate="timesTempMax" monthNum="13" startText="开始"
				endText="结束" :showSubtitle="false" :defaultDate="defaultDateMultiple" mode="range" :allowSameDay="true">
			</u-calendar>
		</view>
		<scroll-view scroll-y :style="{ height: (height - tabBarHeight) + 'px'}" class="content">
			<!-- 营收统计 -->
			<view v-if="current == 0">
				<view class="operate-pie">
					<view class="content">
						<view class="u-flex u-row-around">
							<view class="money-warp" @click="nav(13,'')">
								<view class="theme-text"
									style="margin-top:60rpx;color:rgba(0, 0, 0, 0.9);font-size: 42rpx;">
									￥{{userStatistics.turnover.toFixed(2)}}
								</view>
								<view class="theme">
									<view>总营业额</view>
								</view>
							</view>
							<view class="money-warp" @click="freePopup=true">
								<view class="theme-text2"
									style="margin-top: 60rpx;color: rgb(254, 64, 76);font-size: 42rpx">
									￥{{userStatistics.settlementMoney.toFixed(2)}}
								</view>
								<view class="theme">
									<view>总结算额（线上 - 手续费）</view>
								</view>
							</view>
						</view>
					</view>
				</view>
				<!-- 饼图 -->
				<view class="pie" style="height:470rpx;">
					<view style="width:800rpx;height:450rpx;">
						<echarts @optionData="optionData" ref="echarts1" :option="option" canvasId="echarts1"></echarts>
					</view>
				</view>

			</view>
			<!-- 顾客消费统计 -->
			<view v-if="current == 2">
				<view class="module u-p-30">
					<view class="u-flex-center">
						<image :src="`${staticFileUrl}/image/stats/customer.png`" style="width: 48rpx;height: 48rpx;">
						</image>
						<view class="title-coin u-m-l-12">顾客消费数据</view>
					</view>
					<view class="u-m-l-56 u-m-r-56 u-m-t-40 u-m-b-36">
						<view class="size-28-color-34"><text>消费顾客</text><text
								class="u-p-l-10">{{userStatistics.memberConsumeNum}}人</text></view>
						<view class="u-flex u-row-between size-28-color-102 u-m-t-20">
							<view><text>新顾客</text><text class="u-p-l-30">{{userStatistics.memberConsumeNewNum}}人</text>
							</view>
							<view><text>老顾客</text><text class="u-p-l-30">{{userStatistics.memberConsumeOldNum}}人</text>
							</view>
						</view>
					</view>
					<u-line color="rgba(0, 0, 0, 0.1);"></u-line>
					<view class="u-m-l-56 u-m-r-0 u-m-t-36 u-m-b-36">
						<view class="size-28-color-34"><text>平均客单价</text><text
								class="u-p-l-30">{{userStatistics.averagePrice}}元</text></view>
						<view class="u-flex u-row-between size-28-color-102 u-m-t-20">
							<view><text>最高客单价</text><text class="u-p-l-30">{{userStatistics.maximumUnitPrice}}元</text>
							</view>
							<view><text>最低客单价</text><text class="u-p-l-30">{{userStatistics.minimumUnitPrice}}元</text>
							</view>
						</view>
					</view>
					<u-line color="rgba(0, 0, 0, 0.1);"></u-line>
					<view class="u-m-l-56 u-m-r-0 u-m-t-36 u-m-b-36 size-28-color-0">
						<text>新增留存手机号会员</text><text class="u-p-l-50">{{userStatistics.leaveMemberPhoneNumber}}人</text>
					</view>
				</view>
			</view>
			<!-- 套餐 -->
			<view v-if="current == 1">
				<!-- 门店销售 -->
				<view class="module">
					<view class="bg-store" :style="[{background: backgroundImage}]">
						<image class="image-38" :src="`${staticFileUrl}/image/stats/store-stats.png`"></image>
						<view class="size-28-color-0 u-m-l-20">门店销售</view>
					</view>
					<view class="u-m-24">
						<view class="u-flex u-row-between">
							<view class="name">
								商品名称
							</view>
							<view class="number"
								@click="commonPackageSort(packageTypeEnum.STORE,buttonTypeEnum.QUANTITY,userStatistics.statistStorePackageList)">
								<view class="u-flex-center">
									<view class="u-m-r-8">成交笔数</view>
									<view class="icon-up-down">
										<u-icon name="arrow-up-fill" size="8"
											:color="storeDealCountUp?'rgb(51, 51, 51);':'rgba(51, 51,51,0.5);'">
										</u-icon>
										<u-icon name="arrow-down-fill" size="8"
											:color="storeDealCountDown?'rgb(51, 51, 51);':'rgba(51, 51, 51,0.5);'">
										</u-icon>
									</view>
								</view>
							</view>
							<view class="price red-price"
								@click="commonPackageSort(packageTypeEnum.STORE,buttonTypeEnum.AMOUNT,userStatistics.statistStorePackageList)">
								<view class="u-flex-center">
									<view class="u-m-r-8">成交金额</view>
									<view>
										<u-icon name="arrow-up-fill" size="8"
											:color="storeDealMoneyUp?'rgb(254, 64, 76);':'rgba(254, 64, 76,0.5);'">
										</u-icon>
										<u-icon name="arrow-down-fill" size="8"
											:color="storeDealMoneyDown?'rgb(254, 64, 76);':'rgba(254, 64, 76,0.5);'">
										</u-icon>
									</view>
								</view>
							</view>
						</view>
						<view class="size-28-color-34 u-p-20" v-if="userStatistics.statistStorePackageList.length>0"
							v-for="(item,index) in userStatistics.statistStorePackageList" :key="index">
							<u-row>
								<u-col span="4">
									<view>{{item.title}}</view>
								</u-col>
								<u-col span="4">
									<view style="text-align: right;">{{item.packagePayCount}}</view>
								</u-col>
								<u-col span="4">
									<view class="red-price">{{item.packageTotalAmount}}</view>
								</u-col>
							</u-row>
						</view>
						<view v-if="$u.test.isEmpty(userStatistics.statistStorePackageList)" class="u-p-b-20">
							<u-empty text="暂无门店销售" mode="list" icon="http://cdn.uviewui.com/uview/empty/list.png">
							</u-empty>
						</view>
					</view>
				</view>
			</view>

			<!-- 根据场地显示数据 -->
			<template>
				<view v-for="(item,index) in statsStoreVoList" :key="index" @click="navStoreStats(item.mchStoreId,item.storeName)">
					<view>
						<!--  营收 -->
						<template v-if="current == 0">
							<!-- 进度条 购币 -->
							<view class="module u-m-t-30">
								<view class="store-name-title u-flex-center">
									<image :src="`${staticFileUrl}/image/stats/store-logo.png`"
										style="width: 60rpx;height: 60rpx;">
									</image>
									<view class="u-m-l-20">{{item.storeName}}</view>
								</view>
								<view class="u-p-30 u-p-t-10">
									<u-grid :border="false" col="3">
										<u-grid-item :customStyle="gridCustomStyleOne">
											<text class="grid-title">{{item.scanCodePayTotalTurnover}}</text>
											<text class="grid-text">扫码收入</text>
										</u-grid-item>
										<u-grid-item :customStyle="gridCustomStyle">
											<text class="grid-title">{{item.cashMoney}}</text>
											<text class="grid-text">现金收入</text>
										</u-grid-item>
										<u-grid-item :customStyle="gridCustomStyle">
											<text class="grid-title">{{item.activityTurnover}}</text>
											<text class="grid-text">活动收入</text>
										</u-grid-item>
										<!-- @click="nav(4, item.mchStoreId)" -->
										<u-grid-item :customStyle="gridCustomStyleOne">
											<text class="grid-title">{{item.turnoverDouYin}}</text>
											<text class="grid-text">抖音核销</text>
										</u-grid-item>
										<u-grid-item :customStyle="gridCustomStyle">
											<text class="grid-title">{{item.turnoverMeiTuan}}</text>
											<text class="grid-text">美团核销</text>
										</u-grid-item>
									</u-grid>
								</view>
								<view class="u-m-l-30 u-m-r-30">
									<u-line color="rgba(101, 139, 254, 0.5)"></u-line>
								</view>
								<view class="u-p-30 u-p-t-10">
									<u-grid :border="false" col="3">
										<u-grid-item :customStyle="gridCustomStyleOne">
											<text class="grid-title">{{item.turnoverGameCoin}}</text>
											<text class="grid-text">售币总额</text>
										</u-grid-item>
										<u-grid-item :customStyle="gridCustomStyle">
											<text class="grid-title">{{item.quantityOfCoinsSold}}</text>
											<text class="grid-text">售币数量</text>
										</u-grid-item>
										<u-grid-item :customStyle="gridCustomStyle">
											<text class="grid-title">{{item.averageCoinPrice}}</text>
											<text class="grid-text">平均单价</text>
										</u-grid-item>
										<!-- @click="nav(4, item.mchStoreId)" -->
										<u-grid-item :customStyle="gridCustomStyleOne">
											<text class="grid-title">{{item.amountOfCoinsConsumed}}</text>
											<text class="grid-text">币消耗数量</text>
										</u-grid-item>
										<u-grid-item :customStyle="gridCustomStyle">
											<text class="grid-title">{{item.remainingCoins}}</text>
											<text class="grid-text">余币数量</text>
										</u-grid-item>
									</u-grid>
									<view v-if="item.quantityOfCoinsSold > 0" class="u-m-t-40">
										<view v-if="item.onLinePayOutCoinTotal > 0"
											class="u-flex u-row-between u-m-t-30"  @click.stop="nav(5, item.mchStoreId)">
											<view class="u-flex u-row-between">
												<view class="pay">扫码购币</view>
												<view style="width: 367rpx;">
													<u-line-progress :height="10"
														:percentage="item.percentOnLinePayOutCoinTotal"
														:showText="false" activeColor="#FEB661">
													</u-line-progress>
												</view>
											</view>
											<view class="income-type">{{item.onLinePayOutCoinTotal}}</view>
										</view>
										<view v-if="item.offLinePayOutCoinTotal > 0"
											class="u-flex u-row-between u-m-t-30"  @click.stop="nav(6, item.mchStoreId)">
											<view class="u-flex u-row-between">
												<view class="pay">现金购币</view>
												<view style="width: 367rpx;">
													<u-line-progress :height="10"
														:percentage="item.percentOffLinePayOutCoin" :showText="false"
														activeColor="#6072FF">
													</u-line-progress>
												</view>
											</view>
											<view class="income-type">{{item.offLinePayOutCoinTotal}}</view>
										</view>
										<view v-if="item.douYinOutCoinTotal > 0" class="u-flex u-row-between u-m-t-30"
                          @click.stop="nav(19, item.mchStoreId)">
											<view class="u-flex u-row-between">
												<view class="pay">抖音核销</view>
												<view style="width: 367rpx;">
													<u-line-progress :height="10"
														:percentage="item.percentDouYinOutCoin" :showText="false"
														activeColor="#FEB661">
													</u-line-progress>
												</view>
											</view>
											<view class="income-type">
												{{item.douYinOutCoinTotal}}
											</view>
										</view>
										<view v-if="item.meiTuanOutCoinTotal > 0" class="u-flex u-row-between u-m-t-30"
											@click.stop="nav(20, item.mchStoreId)">
											<view class="u-flex u-row-between">
												<view class="pay">美团核销</view>
												<view style="width: 367rpx;">
													<u-line-progress :height="10"
														:percentage="item.percentMeiTuanOutCoin" :showText="false"
														activeColor="#6072FF">
													</u-line-progress>
												</view>
											</view>
											<view class="income-type">
												{{item.meiTuanOutCoinTotal}}
											</view>
										</view>
										<view v-if="item.fetchMemberOutCoinTotal > 0"
											class="u-flex u-row-between u-m-t-30"  @click.stop="nav(18, item.mchStoreId)">
											<view class="u-flex u-row-between">
												<view class="pay">会员取币</view>
												<view style="width: 367rpx;">
													<u-line-progress :height="10"
														:percentage="item.percentFetchMemberOutCoin" :showText="false"
														activeColor="#FEB661">
													</u-line-progress>
												</view>
											</view>
											<view class="income-type">{{item.fetchMemberOutCoinTotal}}</view>
										</view>

										<view v-if="item.weiXinVerifyTotalCoin > 0"
											class="u-flex u-row-between u-m-t-30"  @click.stop="nav(25, item.mchStoreId)">
											<view class="u-flex u-row-between">
												<view class="pay">微信核销</view>
												<view style="width: 367rpx;">
													<u-line-progress :height="10"
														:percentage="item.percentWeiXinVerifyOutCoin" :showText="false"
														activeColor="#6072FF">
													</u-line-progress>
												</view>
											</view>
											<view class="income-type">
												{{item.weiXinVerifyTotalCoin}}
											</view>
										</view>
										<view v-if="item.artificialOutCoinTotal > 0"
											class="u-flex u-row-between u-m-t-30"  @click.stop="nav(21, item.mchStoreId)">
											<view class="u-flex u-row-between">
												<view class="pay">人工出币</view>
												<view style="width: 367rpx;">
													<u-line-progress :height="10"
														:percentage="item.percentArtificialOutCoin" :showText="false"
														activeColor="#FEB661">
													</u-line-progress>
												</view>
											</view>
											<view class="income-type">
												{{item.artificialOutCoinTotal}}
											</view>
										</view>
										<view v-if="item.distributeBenefitCoinTotal > 0"
											class="u-flex u-row-between u-m-t-30"  @click.stop="nav(27, item.mchStoreId)">
											<view class="u-flex u-row-between">
												<view class="pay">派发福利</view>
												<view style="width: 367rpx;">
													<u-line-progress :height="10"
														:percentage="item.percentDistributeBenefitCoin"
														:showText="false" activeColor="#6072FF">
													</u-line-progress>
												</view>
											</view>
											<view class="income-type">{{item.distributeBenefitCoinTotal}}</view>
										</view>
										<view v-if="item.gameCoinRedPacketCoinTotal > 0"
											class="u-flex u-row-between u-m-t-30"  @click.stop="nav(26, item.mchStoreId)">
											<view class="u-flex u-row-between">
												<view class="pay">代币红包</view>
												<view style="width: 367rpx;">
													<u-line-progress :height="10"
														:percentage="item.percentCoinRedPacketCoin" :showText="false"
														activeColor="#FEB661">
													</u-line-progress>
												</view>
											</view>
											<view class="income-type">{{item.gameCoinRedPacketCoinTotal}}</view>
										</view>
										<view v-if="item.groupBenefitCoinTotal > 0"
											class="u-flex u-row-between u-m-t-30" @click.stop="nav(28, item.mchStoreId)">
											<view class="u-flex u-row-between">
												<view class="pay">加群福利</view>
												<view style="width: 367rpx;">
													<u-line-progress :height="10"
														:percentage="item.percentGroupBenefitCoin" :showText="false"
														activeColor="#6072FF">
													</u-line-progress>
												</view>
											</view>
											<view class="income-type">{{item.groupBenefitCoinTotal}}</view>
										</view>
									</view>
									<view v-else class="none">
										<u-empty text="暂无售币" mode="list"
											icon="http://cdn.uviewui.com/uview/empty/list.png">
										</u-empty>
									</view>
								</view>
							</view>
							<!-- 进度条 投币 -->
							<view class="module u-m-t-30 u-p-30">
								<view class="u-flex u-row-between u-m-b-10">
									<view class="title-coin">投币情况</view>
									<view class="title-coin" @click.stop="nav(7, item.mchStoreId)">
										<text>合计：</text>
										<text style="color: #6072FF;">{{item.insertCoinTotal}}</text>
									</view>
								</view>
								<view v-if="item.insertCoinTotal > 0">
									<view class="u-flex u-row-between u-m-t-30" @click.stop="nav(8, item.mchStoreId)">
										<view class="u-flex u-row-between">
											<view class="pay">线上投币</view>
											<view style="width: 367rpx;">
												<u-line-progress :height="10" :percentage="item.percentInsertCoinOnLine"
													:showText="false" activeColor="#6072FF">
												</u-line-progress>
											</view>
										</view>
										<view class="income-type">{{item.insertCoinOnLine}}</view>
									</view>
									<view class="u-flex u-row-between u-m-t-30" @click.stop="nav(9, item.mchStoreId)">
										<view class="u-flex u-row-between">
											<view class="pay">线下投币</view>
											<view style="width: 367rpx;">
												<u-line-progress :height="10"
													:percentage="item.percentInsertCoinOffline" :showText="false"
													activeColor="#FEB661">
												</u-line-progress>
											</view>
										</view>
										<view class="income-type">{{item.insertCoinOffline}}</view>
									</view>
								</view>
								<view v-else class="none">
									<u-empty text="暂无投币" mode="list" icon="http://cdn.uviewui.com/uview/empty/list.png">
									</u-empty>
								</view>
							</view>
						</template>
					</view>
				</view>
			</template>
			<view style="height: 50rpx;"></view>
		</scroll-view>
		<tips ref="tipsRef"></tips>
		<u-picker :show="selectStoreShow" :closeOnClickOverlay="true" @close="closeSelectStore()"
			@confirm="selectStoreConfirm" @cancel="closeSelectStore()" :columns="merchantStoreVoList"
			keyName="storeName"></u-picker>
		<u-picker :show="selectDeviceTypeShow" :closeOnClickOverlay="true" @close="closeSelectDeviceType()"
			@confirm="selectDeviceTypeConfirm" @cancel="closeSelectDeviceType()" :columns="deviceTypeVoList"
			keyName="deviceTypeName"></u-picker>

		<u-popup :show="freePopup" mode="center" round="20rpx" :customStyle="{width:'690rpx'}">
			<view class="u-p-50 free-popup">
				<view class="u-font-32 u-m-b-50 u-flex-content-center">手续费/服务费</view>
				<view class="u-flex-row u-row-start u-m-b-30">
					<view>扫码收入手续费：</view>
					<view>
						<text>{{userStatistics.scanningFee}}</text>
						<text>元</text>
					</view>
				</view>
				<view class="u-flex-row u-row-start u-m-b-30" v-if="userStatistics.tiktokCancellationFee > 0">
					<view>抖音核销服务费：</view>
					<view>
						<text>{{userStatistics.tiktokCancellationFee}}</text>
						<text>元</text>
					</view>
				</view>
				<view class="u-flex-row u-row-start u-m-b-30" v-if="userStatistics.meiTuanCancellationFee > 0">
					<view>美团核销服务费：</view>
					<view>
						<text>{{userStatistics.gridmeiTuanCancellationFee}}</text>
						<text>元</text>
					</view>
				</view>
				<view class="u-m-t-50">
					<u-button text="我已知悉" color="#6072FF" shape="circle"
						:customStyle="{height: '80rpx',width: '380rpx'}" @click="freePopup=false"
						:safeAreaInsetBottom="false" />
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import tips from '@/components/management-tips/management-tips.vue'
	import echarts from '@/pages-other/operation-stats/echarts-uniapp/echarts-uniapp.vue'
	import rankingListStats from '@/components/ranking-list-stats/ranking-list-stats.vue'
	export default {
		components: {
			tips,
			echarts,
			rankingListStats
		},
		props: {
			// 底部导航栏高度
			tabBarHeight: {
				type: Number,
				default: 0
			}
		},
		data() {
			return {
				gridCustomStyle: {
					background: 'rgba(101, 139, 254, 0.05)',
					borderRadius: '10rpx',
					padding: '20rpx 0rpx',
					marginLeft: '15rpx',
					width: '204rpx'
				},
				gridCustomStyleOne: {
					background: 'rgba(101, 139, 254, 0.05)',
					borderRadius: '10rpx',
					padding: '20rpx 0rpx',
					width: '204rpx',
					marginTop: '20rpx',
				},
				package: {
					statistStorePackageList: [],
					statistDouYinPackageList: [],
					statistMeiTuanPackageList: [],
					statistTicketUsageRecordList: [],
				},
				//成交数量排序默认从小到大
				storeDealCountUp: false,
				storeDealCountDown: false,
				sortList: [],
				//成交金额排序
				storeDealMoneyUp: false,
				storeDealMoneyDown: true,

				douYinDealCountUp: false,
				douYinDealCountDown: false,
				douYinDealMoneyUp: false,
				douYinDealMoneyDown: true,

				meiTuanDealCountUp: false,
				meiTuanDealCountDown: false,
				meiTuanDealMoneyUp: false,
				meiTuanDealMoneyDown: true,

				ticketUsageUp: false,
				ticketUsageDown: false,

				//成交数量排序默认从小到大
				storeDealCountUpTwo: false,
				storeDealCountDownTwo: false,
				//成交金额排序
				storeDealMoneyUpTwo: false,
				storeDealMoneyDownTwo: true,

				douYinDealCountUpTwo: false,
				douYinDealCountDownTwo: false,
				douYinDealMoneyUpTwo: false,
				douYinDealMoneyDownTwo: true,

				meiTuanDealCountUpTwo: false,
				meiTuanDealCountDownTwo: false,
				meiTuanDealMoneyUpTwo: false,
				meiTuanDealMoneyDownTwo: true,

				// meiTuanDealMoneyUpTwo: false,
				// meiTuanDealMoneyDownTwo: true,

				statsList: [{
					id: 0,
					name: '营收',
				}, {
					id: 1,
					name: '商品'
				}, {
					id: 2,
					name: '顾客'
				}],
				backgroundImage: 'url(' + this.$configPath.staticFileUrl +
					'/image/stats/top-left-corner-bg.png)no-repeat 0rpx 0rpx',
				current: 0,
				option: {
					// tooltip: {
					//   trigger: 'item'
					// },
					// legend: {
					//   top: '5%',
					//   left: 'center'
					// },
					series: [{
						type: 'pie',
						color: [
							'#3AA1FF',
							'#F2637B',
							// '#FBD437',
							'#4ECB73',
							'#36CBCB',
						],
						label: {
							alignTo: 'edge',
							formatter: '{name|{b}}\n{time|{c} 元}',
							minMargin: 5,
							edgeDistance: 10,
							lineHeight: 20,
							fontSize: 13,
							rich: {
								time: {
									fontSize: 13,
									color: '#999' //修改饼图金额的颜色
								}
							}
						},

						itemStyle: {
							borderColor: '#fff',
							borderWidth: 1
						},
						labelLine: {
							length: 10,
							length2: 0,
							maxSurfaceAngle: 80,
							show: true,
						},
						radius: ['30%', '50%'],
						avoidLabelOverlap: true,
						// label: {
						// 	show: false,
						// 	position: 'center',
						// },
						emphasis: {
							label: {
								show: true,
								fontSize: 15,
								fontWeight: 'bold'
							}
						},

						data: [{
								value: 0,
								name: '扫码收入',
								typeId: this.$operateTypeEnum.ONLINE_INCOME,
							},
							{
								value: 1,
								name: '现金收入',
								typeId: this.$operateTypeEnum.CASH_INCOME,
							},
              //
							// {
							// 	value: 0,
							// 	name: '活动收入',
							// 	typeId: this.$operateTypeEnum.ACTIVITY_INCOME,
							// },
							{
								value: 0,
								name: '美团核销',
								typeId: this.$operateTypeEnum.MEITUAN,
							},
							{
								value: 0,
								name: '抖音核销',
								typeId: this.$operateTypeEnum.DOUYIN,
							}
						],
					}]
				},
				selectStoreShow: false,
				selectDeviceTypeShow: false,
				staticFileUrl: this.$configPath.staticFileUrl,
				title: '经营统计',
				titleStyle: 'color:white',
				leftIconColor: 'white',
				date: '',
				showTime: false,
				height: 0,
				params: {
					pageNum: 1,
					pageSize: 5,
					type: 1,
				},
				loadmoreStatus: 'loadmore',
				loadingText: '努力加载中',
				loadmoreText: '轻轻上拉',
				nomoreText: '实在没有了',

				datetime: 'date',
				//全部场地
				totalMerchantStore: 0,
				userStatistics: {
					//营业额
					turnover: 0,
					//结算
					settlementMoney: 0,
					//现金收入
					cashMoney: 0,
					//线上扫码
					turnoverOnLine: 0,
					//线下扫码
					turnoverOfflineCollectionCode: 0,
					//扫码收入
					scanCodePayTotalTurnover: 0,
					//活动收入
					activityTurnover: 0,
					//总出币
					outCoinTotal: 0,
					//线上出币
					onLinePayOutCoinTotal: 0,
					//现金购币
					offLinePayOutCoinTotal: 0,
					//总投币
					insertCoinTotal: 0,
					//线上投币
					insertCoinOnLine: 0,
					//线下投币
					insertCoinOffline: 0,
					//礼品消耗
					giftConsume: 0,
					//礼品成本
					giftCost: 0,
					//出礼率
					giftOutRate: 0,

					//总设备
					totalDevice: 0,
					//留存手机号会员
					leaveMemberPhoneNumber: 0,
					//最小消费金额
					minimumUnitPrice: 0,
					//最大消费金额
					maximumUnitPrice: 0,
					//顾客平均消费
					averagePrice: 0,
					//新顾客
					memberConsumeNewNum: 0,
					//老顾客
					memberConsumeOldNum: 0,
					//消费顾客
					memberConsumeNum: 0,
					//美团核销出币
					meiTuanOutCoinTotal: 0,
					//抖音核销出币
					douYinOutCoinTotal: 0,
					//微信秒杀核销
					weiXinSeckillOutCoinTotal: 0,
					//微信拼团核销
					weiXinGroupBuyingOutCoinTotal: 0,
					//微信卡劵核销
					weiXinVoucherOutCoinTotal: 0,
					//微信核销总出币
					weiXinVerifyTotalCoin: 0,
					//会员取币
					fetchMemberOutCoinTotal: 0,
					//人工出币
					artificialOutCoinTotal: 0,
					//现金购币 / 总出币 = 百分比
					percentOffLinePayOutCoin: 0,
					//会员出币 / 总出币 = 百分比
					percentFetchMemberOutCoin: 0,
					//线上出币 / 总出币 = 百分比
					percentOnLinePayOutCoinTotal: 0,
					//人工出币 / 总出币 = 百分比
					percentArtificialOutCoin: 0,
					//抖音核销出币 / 总出币 = 百分比
					percentDouYinOutCoin: 0,
					//美团核销出币 / 总出币 = 百分比
					percentMeiTuanOutCoin: 0,
					//微信核销出币 / 总出币 = 百分比
					percentWeiXinVerifyOutCoin: 0,
					//线下投币 / 总出币 = 百分比
					percentInsertCoinOffline: 0,
					//线上投币 / 总出币 = 百分比
					percentInsertCoinOnLine: 0,
					//游戏币红包 / 总出币 = 百分比
					percentCoinRedPacketCoin: 0,
					//加群福利 / 总出币 = 百分比
					percentGroupBenefitCoin: 0,
					//派发福利 / 总出币 = 百分比
					percentDistributeBenefitCoin: 0,
					//游戏币营业额
					turnoverGameCoin: 0,
					//售币数量
					quantityOfCoinsSold: 0,
					//币平均单价
					averageCoinPrice: 0,
					//余币数量
					remainingCoins: 0,
					//出币数量
					amountOfCoinsConsumed: 0,
					//抖音核销 百分比
					percentTurnoverDouYin: 0,
					//美团核销 百分比
					percentTurnoverMeiTuan: 0,
					//现金 百分比
					percentCashMoney: 0,
					//微信活动 百分比
					percentActivityTurnover: 0,
					//扫码收入 百分比
					percentTurnoverOnLine: 0,
					//充值余额
					storedValueComplimentaryBalance: 0,
					//赠送余额
					storedValueRechargeBalance: 0,
					//消费充值余额
					consumeRechargeBalance: 0,
					//消费赠送余额
					consumeComplimentaryBalance: 0,
					statistStorePackageList: [],
					statistDouYinPackageList: [],
					statistMeiTuanPackageList: [],
					statistTicketUsageRecordList: [],
					groupBenefitCoinTotal: 0,
					distributeBenefitCoinTotal: 0,
				},
				//记录总数据
				userStatisticsSpare: {},
				selectDayType: 0,
				startTime: null,
				endTime: null,
				startDateStr: '',
				endDateStr: '',
				timePickerType: '',
				datePicker: new Date().getTime(),
				statsStoreVoList: [],
				merchantStoreVoList: [],
				selectMchStoreId: -1,
				selectMchStoreName: '',
				deviceTypeVoList: [],
				selectDeviceTypeId: -1,
				selectDeviceTypeName: '',
				timesTempMin: '',
				timesTempMax: '',
				defaultDateMultiple: [this.$date.dateFormatYMD(new Date()), this.$date.dateFormatYMD(new Date())],
				incomeList: [],
				tabsBoolean: false,

				freePopup: false,
				freePopup2: false,
				branchIdEnum: this.$statsBranchIdEnum,
				statsType: 1,
				//排序套餐枚举
				packageTypeEnum: {
					STORE: 1,
					DOU_YIN: 2,
					MEI_TUAN: 3,
					TICKET: 4,
				},
				//排序类型枚举
				buttonTypeEnum: {
					QUANTITY: 1,
					AMOUNT: 2,
				}
			}
		},
		// 下拉刷新
		methods: {
			// 下面几个大写开头的分别对应on***,因为组件只能通过父组件调用才有生命周期
			Load() {
				this.loadData();
				this.startTime = new Date();
				this.endTime = new Date();
				this.startDateStr = this.$date.dateFormatYMD(this.startTime);
				this.endDateStr = this.$date.dateFormatYMD(this.endTime);
				this.findAllMerchantStoreByUserId();
				this.getAllDeviceType();
			},
			Ready() {
				this.timesTempMin = Number(new Date().setFullYear((new Date().getFullYear() - 1)))
				this.timesTempMax = Number(this.$date.getEndDate())
				this.getPomHeight()
			},
			PullDownRefresh() {
				this.loadData();
			},
			//场地
			findAllMerchantStoreByUserId() {
				this.$api('merchantStore.findAllMerchantStoreByUserId', null).then(res => {
					// console.log(res.data, '数据')
					if (res.status == 0) {
						this.totalMerchantStore = res.data.length
						// console.log('res.data.length', res.data.length)
						let merchantStoreColumns = [];
						let merchantStoreAll = {
							id: -1,
							storeName: '全部场地'
						}
						merchantStoreColumns.push(merchantStoreAll);
						merchantStoreColumns = [...merchantStoreColumns, ...res.data]
						this.merchantStoreVoList = []
						this.merchantStoreVoList.push(merchantStoreColumns)
					}
				})
			},
			//点击饼图跳转
			optionData(event) {
				console.log('点击事件触发', event);
				let mchStoreId = '';
				if (this.selectMchStoreId != -1) {
					mchStoreId = this.selectMchStoreId
				}
				uni.navigateTo({
					url: "/pages-other/operation-stats/income-type/income-type"
						.concat("?typeId=").concat(event.typeId)
						.concat("&startDateStr=").concat(this.startDateStr)
						.concat("&endDateStr=").concat(this.endDateStr)
						.concat("&selectDayType=").concat(this.selectDayType)
						.concat("&mchStoreId=").concat(mchStoreId)
				})
			},
			//套餐排序
			commonPackageSort(packageType, operationType, list) {
				if (this.$u.test.isEmpty(list)) {
					return
				}
				//门店套餐排序
				if (packageType == this.packageTypeEnum.STORE) {
					if (operationType == this.buttonTypeEnum.QUANTITY) {
						if (!this.storeDealCountUp) {
							//降序
							list.sort((b, a) => b.packagePayCount - a.packagePayCount);
							this.storeDealCountDown = false
							this.storeDealCountUp = true
						} else {
							//升序
							list.sort((a, b) => b.packagePayCount - a.packagePayCount);
							this.storeDealCountDown = true
							this.storeDealCountUp = false
						}
						this.storeDealMoneyUp = false
						this.storeDealMoneyDown = false
					} else if (operationType == this.buttonTypeEnum.AMOUNT) {
						if (!this.storeDealMoneyUp) {
							//降序
							list.sort((b, a) => b.packageTotalAmount - a.packageTotalAmount);
							this.storeDealMoneyDown = false
							this.storeDealMoneyUp = true

						} else {
							//升序
							list.sort((a, b) => b.packageTotalAmount - a.packageTotalAmount);
							this.storeDealMoneyDown = true
							this.storeDealMoneyUp = false
						}
						this.storeDealCountUp = false
						this.storeDealCountDown = false
					}
				} else if (packageType == this.packageTypeEnum.DOU_YIN) {
					if (operationType == this.buttonTypeEnum.QUANTITY) {
						if (!this.douYinDealCountUp) {
							//降序
							this.userStatistics.statistDouYinPackageList.sort((b, a) => b.packagePayCount - a
								.packagePayCount);
							this.douYinDealCountDown = false
							this.douYinDealCountUp = true
						} else {
							//升序
							this.userStatistics.statistDouYinPackageList.sort((a, b) => b.packagePayCount - a
								.packagePayCount);
							this.douYinDealCountDown = true
							this.douYinDealCountUp = false
						}
						this.douYinDealMoneyUp = false
						this.douYinDealMoneyDown = false
					} else if (operationType == this.buttonTypeEnum.AMOUNT) {
						if (!this.douYinDealMoneyUp) {
							//降序
							this.userStatistics.statistDouYinPackageList.sort((b, a) => b.packageTotalAmount - a
								.packageTotalAmount);
							this.douYinDealMoneyDown = false
							this.douYinDealMoneyUp = true

						} else {
							//升序
							this.userStatistics.statistDouYinPackageList.sort((a, b) => b.packageTotalAmount - a
								.packageTotalAmount);
							this.douYinDealMoneyDown = true
							this.douYinDealMoneyUp = false
						}
						this.douYinDealCountUp = false
						this.douYinDealCountDown = false
					}
				} else if (packageType == this.packageTypeEnum.MEI_TUAN) {
					if (operationType == this.buttonTypeEnum.QUANTITY) {
						if (!this.meiTuanDealCountUp) {
							//降序
							this.userStatistics.statistMeiTuanPackageList.sort((b, a) => b.packagePayCount - a
								.packagePayCount);
							this.meiTuanDealCountDown = false
							this.meiTuanDealCountUp = true
						} else {
							//升序
							this.userStatistics.statistMeiTuanPackageList.sort((a, b) => b.packagePayCount - a
								.packagePayCount);
							this.meiTuanDealCountDown = true
							this.meiTuanDealCountUp = false
						}
						this.meiTuanDealMoneyUp = false
						this.meiTuanDealMoneyDown = false
					} else if (operationType == this.buttonTypeEnum.AMOUNT) {
						if (!this.meiTuanDealMoneyUp) {
							//降序
							this.userStatistics.statistMeiTuanPackageList.sort((b, a) => b.packageTotalAmount - a
								.packageTotalAmount);
							this.meiTuanDealMoneyDown = false
							this.meiTuanDealMoneyUp = true

						} else {
							//升序
							this.userStatistics.statistMeiTuanPackageList.sort((a, b) => b.packageTotalAmount - a
								.packageTotalAmount);
							this.meiTuanDealMoneyDown = true
							this.meiTuanDealMoneyUp = false
						}
						this.meiTuanDealCountUp = false
						this.meiTuanDealCountDown = false
					}
				} else if (packageType == this.packageTypeEnum.TICKET) {
					if (!this.ticketUsageUp) {
						//降序
						list.sort((b, a) => b.totalTime - a.totalTime);
						this.ticketUsageDown = false
						this.ticketUsageUp = true
					} else {
						//升序
						list.sort((a, b) => b.totalTime - a.totalTime);
						this.ticketUsageDown = true
						this.ticketUsageUp = false
					}
				} else {
					getApp().err("暂无此操作");
				}
			},
			//导航切换
			clickCurrent(e) {
				this.current = e.id
				if (this.current == 0) {
					this.statsTurnover()
					this.tabsBoolean = true
				} else {
					this.tabsBoolean = false
					this.$nextTick(() => {
						this.option.series[0].data[0].value = -0.01
					})
				}
			},
			//加载数据
			loadData() {
				//统计全部
				this.findAllStatsStoreList();
			},
			findAllStatsStoreList() {
				uni.showLoading({
					title: '加载中...',
					mask: true
				})
				let params = {
					dayType: this.selectDayType,
					startDateStr: this.startDateStr,
					endDateStr: this.endDateStr
				}
				this.$api('statsStore.findAllStatsStoreList', params).then(res => {
					if (res.status == 0) {
						uni.hideLoading();
						//页面显示用
						this.userStatistics = res.data
						//记录总数据
						this.userStatisticsSpare = JSON.parse(JSON.stringify(res.data))
						//单场地查询
						if (this.selectMchStoreId != -1) {
							this.assignmentOneStore(res.data.statsStoreVoList);
						} else {
							//页面显示用
							this.statsStoreVoList = res.data.statsStoreVoList;
						}
						//营收导航的时候赋值
						if (this.current == 0) {
							this.statsTurnover();
						}
					} else {
						uni.hideLoading();
						this.$helpers.toast('请求数据失败:' + res.msg);
					}
				}).catch(() => {
          uni.hideLoading();
        })
			},
			//全部场地--赋值数据给饼图
			statsTurnover() {
				this.$nextTick(() => {
					this.option.series[0].data[0].value = this.userStatistics.scanCodePayTotalTurnover
					this.option.series[0].data[1].value = this.userStatistics.cashMoney
					// this.option.series[0].data[2].value = this.userStatistics.activityTurnover
					this.option.series[0].data[2].value = this.userStatistics.turnoverMeiTuan
					this.option.series[0].data[3].value = this.userStatistics.turnoverDouYin
					this.option.series[0].data[0].name = '扫码收入(' + this.userStatistics.percentTurnoverOnLine + '%)'
					this.option.series[0].data[1].name = '现金收入(' + this.userStatistics.percentCashMoney + '%)'
					// this.option.series[0].data[2].name = '活动收入(' + this.userStatistics.percentActivityTurnover +'%)'
					this.option.series[0].data[2].name = '美团核销(' + this.userStatistics.percentTurnoverMeiTuan +
						'%)'
					this.option.series[0].data[3].name = '抖音核销(' + this.userStatistics.percentTurnoverDouYin + '%)'
					// console.log(this.userStatistics.scanCodePayTotalTurnover, "扫码收入？")
					this.$forceUpdate()
				});
			},
			//全部设备
			getAllDeviceType() {
				this.$api('deviceType.curr').then(res => {
					let deviceTypeColumns = [];
					let deviceTypeAll = {
						id: -1,
						deviceTypeName: '全部设备类型'
					}
					deviceTypeColumns.push(deviceTypeAll);
					deviceTypeColumns = [...deviceTypeColumns, ...res.data]
					this.deviceTypeVoList = []
					this.deviceTypeVoList.push(deviceTypeColumns)
				})
			},
			//选择设备类型
			selectDeviceTypeConfirm(e) {
				this.selectDeviceTypeId = e.value[0].id;
				this.selectDeviceTypeName = e.value[0].deviceTypeName
				if (this.selectDeviceTypeId != -1) {
					this.statsList = [{
						id: 0,
						name: '营收'
					}]
				} else {
					this.statsList = [{
						id: 0,
						name: '营收'
					}, {
						id: 1,
						name: '商品'
					}, {
						id: 2,
						name: '顾客'
					}]
				}
				this.closeSelectDeviceType();
				// this.loadData();
			},
			//关闭
			closeSelectDeviceType() {
				this.selectDeviceTypeShow = false;
			},
			showSelectDeviceType() {
				this.selectDeviceTypeShow = true;
			},
			//选择场地
			selectStoreConfirm(e) {
				if (this.selectMchStoreId == e.value[0].id) {
					this.closeSelectStore();
					return
				}
				this.selectMchStoreId = e.value[0].id;
				this.selectMchStoreName = e.value[0].storeName
				this.statsStoreVoList = [];
				const storeList = this.userStatisticsSpare.statsStoreVoList;
				if (this.selectMchStoreId !== -1) {
					this.assignmentOneStore(storeList)
				} else {
					// 如果 selectMchStoreId 是 -1，直接复制所有项
					this.statsStoreVoList = [...storeList];
					this.userStatistics = JSON.parse(JSON.stringify(this.userStatisticsSpare))
				}
				this.statsTurnover();
				this.closeSelectStore();
			},
			//selectMchStoreId 匹配的项
			assignmentOneStore(storeList) {
				this.statsStoreVoList = storeList.filter(item => item.mchStoreId === this.selectMchStoreId);
				// console.log(this.statsStoreVoList, '数据')
				this.statsStoreVoList.forEach(item => {
					this.userStatistics.turnover = item.turnover
					this.userStatistics.settlementMoney = item.settlementMoney
					this.userStatistics.scanCodePayTotalTurnover = item.scanCodePayTotalTurnover
					this.userStatistics.cashMoney = item.cashMoney
					this.userStatistics.activityTurnover = item.activityTurnover
					this.userStatistics.turnoverMeiTuan = item.turnoverMeiTuan
					this.userStatistics.turnoverDouYin = item.turnoverDouYin
					this.userStatistics.scanningFee = item.scanningFee
					this.userStatistics.tiktokCancellationFee = item.tiktokCancellationFee
					this.userStatistics.meiTuanCancellationFee = item.meiTuanCancellationFee
					this.userStatistics.giftConsume = item.giftConsume
					this.userStatistics.giftCost = item.giftCost
					this.userStatistics.giftOutRate = item.giftOutRate
					this.userStatistics.expendTotalIntegral = item.expendTotalIntegral
					this.userStatistics.expendCommodityTotal = item.expendCommodityTotal
					this.userStatistics.incomeTotalIntegral = item.incomeTotalIntegral
					this.userStatistics.incomeCommodityTotal = item.incomeCommodityTotal
					this.userStatistics.incomeTotalLottery = item.incomeTotalLottery
					this.userStatistics.incomeCommodityLottery = item.incomeCommodityLottery
					this.userStatistics.incomeTotalGameCoin = item.incomeTotalGameCoin
					this.userStatistics.incomeCommodityGameCoin = item.incomeCommodityGameCoin
					this.userStatistics.memberConsumeNum = item.memberConsumeNum
					this.userStatistics.memberConsumeNewNum = item.memberConsumeNewNum
					this.userStatistics.memberConsumeOldNum = item.memberConsumeOldNum
					this.userStatistics.averagePrice = item.averagePrice
					this.userStatistics.leaveMemberPhoneNumber = item.leaveMemberPhoneNumber
					this.userStatistics.maximumUnitPrice = item.maximumUnitPrice
					this.userStatistics.minimumUnitPrice = item.minimumUnitPrice
					this.userStatistics.storedValueRechargeBalance = item.storedValueRechargeBalance
					this.userStatistics.storedValueComplimentaryBalance = item.storedValueComplimentaryBalance
					this.userStatistics.consumeRechargeBalance = item.consumeRechargeBalance
					this.userStatistics.consumeComplimentaryBalance = item.consumeComplimentaryBalance
					this.userStatistics.percentTurnoverOnLine = item.percentTurnoverOnLine
					this.userStatistics.percentCashMoney = item.percentCashMoney
					this.userStatistics.percentActivityTurnover = item.percentActivityTurnover
					this.userStatistics.percentTurnoverMeiTuan = item.percentTurnoverMeiTuan
					this.userStatistics.percentTurnoverDouYin = item.percentTurnoverDouYin

					this.userStatistics.statistStorePackageList = item.statistStorePackageList
					this.userStatistics.statistDouYinPackageList = item.statistDouYinPackageList
					this.userStatistics.statistMeiTuanPackageList = item.statistMeiTuanPackageList
					this.userStatistics.statistTicketUsageRecordList = item.statistTicketUsageRecordList
				})
			},
			closeSelectStore() {
				this.selectStoreShow = false;
			},
			showSelectStore() {
				this.selectStoreShow = true;
			},
			changeDayType(num) {
				this.selectDayType = num;
				let time = this.$date.getTime();
				let startTime = '';
				let endTime = '';
				this.defaultDateMultiple = []
				switch (this.selectDayType) {
					case 0:
						// 获取今天的日期
						startTime = this.$date.dateFormatYMD(new Date());
						endTime = this.$date.dateFormatYMD(new Date());
						break;
					case 1:
						// 获取昨天的日期
						startTime = this.$date.dateFormatYMD(time.startYesterday);
						endTime = this.$date.dateFormatYMD(time.startYesterday);
						break;
					case 2:
						// 获取本周的日期
						startTime = this.$date.dateFormatYMD(time.startWeek);
						endTime = this.$date.dateFormatYMD(new Date());
						break;
					case 3:
						// 获取本月的日期
						startTime = this.$date.dateFormatYMD(time.startThisMonth);
						endTime = this.$date.dateFormatYMD(new Date());
						break;
					case 4:
						// 获取上月的日期
						startTime = this.$date.dateFormatYMD(time.startLastMonth);
						endTime = this.$date.dateFormatYMD(time.endLastMonth);
						break;
					case 5:
						// 获取今年的日期
						startTime = this.$date.dateFormatYMD(time.startThisYear);
						endTime = this.$date.dateFormatYMD(new Date());
						break;
				}
				this.defaultDateMultiple.push(startTime)
				this.defaultDateMultiple.push(endTime)
				this.startDateStr = startTime
				this.endDateStr = endTime
				this.loadData();
			},
			//详情
			nav(typeId, mchStoreId) {
				if (typeId > 28 || typeId == 11 || typeId == 12 || typeId == 16 || typeId == 17) {
					this.$helpers.toast('正在开发中，敬请期待');
					return
				}
				uni.navigateTo({
					url: "/pages-other/operation-stats/income-type/income-type"
						.concat("?typeId=").concat(typeId)
						.concat("&startDateStr=").concat(this.startDateStr)
						.concat("&endDateStr=").concat(this.endDateStr)
						.concat("&selectDayType=").concat(this.selectDayType)
						.concat("&mchStoreId=").concat(mchStoreId)
				})
			},
			navStoreStats(mchStoreId, storeName) {
				uni.navigateTo({
					url: "/pages-other/operation-stats/device-stats/device-stats-type"
						.concat("?mchStoreId=").concat(mchStoreId)
						.concat("&startDateStr=").concat(this.startDateStr)
						.concat("&endDateStr=").concat(this.endDateStr)
						.concat("&dayType=").concat(this.selectDayType)
						.concat("&storeName=").concat(JSON.stringify(storeName))
				})
			},
			navStoreTurnoverDetails(mchStoreId, storeName, typeId) {
				uni.navigateTo({
					url: "/pages-other/operation-stats/device-stats/stats-store-type"
						.concat("?mchStoreId=").concat(mchStoreId)
						.concat("&startDateStr=").concat(this.startDateStr)
						.concat("&endDateStr=").concat(this.endDateStr)
						.concat("&typeId=").concat(typeId)
						.concat("&statsType=").concat(this.statsType)
						.concat("&storeName=").concat(JSON.stringify(storeName))
				})
			},
			//详情
			nav2(typeId) {
				uni.navigateTo({
					url: "/pages-other/operation-stats/income-type2/income-type"
						.concat("?typeId=").concat(typeId)
						.concat("&startDateStr=").concat(this.startDateStr)
						.concat("&endDateStr=").concat(this.endDateStr)
						.concat("&selectDayType=").concat(this.selectDayType)
				})
			},
			tips() {
				this.$refs.tipsRef.showShow();
			},
			//日历弹框
			selectTime() {
				this.showTime = true;
				this.selectDayType = -1;

			},
			//自定义时间
			confirmTime(e) {
				this.startDateStr = e[0]
				this.endDateStr = e[e.length - 1]
				this.selectDayType = -1;
				this.showTime = false;
				this.loadData();
			},
			cancelTime() {
				this.showTime = false;
			},
			closeTime() {
				this.showTime = false;
			},

			//计算高度
			getPomHeight() {
				let query = wx.createSelectorQuery().in(this)
				query.select('#header').boundingClientRect()
				query.exec(res => {
					let windowHeight = wx.getSystemInfoSync().windowHeight
					this.height = windowHeight
					for (let i = 0; i < res.length; i++) {
						this.height -= res[i].height;
					}
				})
			},
			// 返回上一页
			leftClick() {
				uni.navigateBack();
			},

		}
	}
</script>

<style lang="scss" scoped>
	/deep/ .u-grid-item {
		margin-top: 20rpx !important;
	}

	.size-28-color-34 {
		color: rgb(34, 34, 34);
		font-size: 28rpx;
		letter-spacing: 1rpx;
	}

	.size-28-color-102 {
		color: rgb(102, 102, 102);
		font-size: 28rpx;
		letter-spacing: 1rpx;
	}

	.size-28-color-0 {
		color: rgb(0, 0, 0);
		font-size: 28rpx;
		letter-spacing: 1rpx;
	}

	.free-popup {
		color: rgba(34, 34, 34, 0.8);
	}

	.bg-store {
		width: 366rpx;
		height: 72rpx;
		background-size: 100% 100% !important;
		background-repeat: no-repeat;
		display: flex;
		align-items: center;

		.image-38 {
			width: 38rpx;
			height: 38rpx;
			margin-left: 50rpx;
		}
	}

	.name {
		// width: 260rpx;
		background: rgb(246, 246, 246);
		border-radius: 2rpx;
		padding: 11rpx 100rpx 11rpx 24rpx;
		color: rgb(68, 68, 68);
		font-size: 28rpx;
		letter-spacing: 1rpx;
	}

	.number {
		background: rgb(238, 240, 242);
		border-radius: 2rpx;
		color: rgb(51, 51, 51);
		font-size: 28rpx;
		letter-spacing: 1rpx;
		padding: 11rpx 22rpx;
	}

	.price {
		background: rgb(255, 240, 241);
		border-radius: 2rpx;
		padding: 11rpx 22rpx;
	}

	.red-price {
		color: rgb(254, 64, 76);
		font-size: 28rpx;
		letter-spacing: 1rpx;
		text-align: right;
	}

	.select-item {
		width: 83rpx;
		height: 40rpx;
		border-radius: 20rpx;
		background-color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 26rpx;
		color: rgb(96, 114, 255);
		border: 2rpx solid rgba(255, 255, 255, 0.8);
	}

	.custom {
		width: 156rpx;
		height: 40rpx;
		font-size: 26rpx;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: space-between;
		text-align: center;
		border: 2rpx solid rgba(255, 255, 255, 0.8);
		border-radius: 20rpx;
	}

	.custom-select {
		width: 156rpx;
		height: 40rpx;
		font-size: 26rpx;
		color: rgb(96, 114, 255);
		display: flex;
		align-items: center;
		justify-content: space-between;
		text-align: center;
		border: 2rpx solid rgba(255, 255, 255, 0.8);
		border-radius: 20rpx;
		background-color: #FFFFFF;
	}

	.no-select-item {
		width: 83rpx;
		height: 40rpx;
		border-radius: 20rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 26rpx;
		color: #FFFFFF;
		text-align: center;
		border: 2rpx solid rgba(255, 255, 255, 0.8);
	}

	.title-coin {
		color: rgba(34, 34, 34, 0.8);
		font-size: 32rpx;
		letter-spacing: 1rpx;
	}

	.store-name-title {
		padding: 14rpx 30rpx;
		border-radius: 26rpx 26rpx 0rpx 0rpx;
		background: rgba(63, 120, 254, 0.1);
		font-size: 26rpx;
		color: rgba(0, 0, 0, 0.9);
	}

	.main {
		background-repeat: no-repeat;
		background-size: 100% 100%;
		width: 100%;
		height: 583rpx;

		.header {

			/deep/ .u-tabs__wrapper__nav__item {
				padding: 0 110rpx 0 110rpx;
			}

			.operate-left {
				margin: 43rpx 0 0 30rpx;
				font-size: 26rpx;
				color: rgba(255, 255, 255, 0.9);
				display: flex;
				align-items: center;

				.left-title {
					margin-right: 10rpx;
				}
			}
		}

		.radrids {
			border-radius: 26rpx;
			margin-bottom: 24rpx;
		}

		.operate-pie {
			margin: 0rpx 24rpx 0rpx 24rpx;
			border-radius: 26rpx 26rpx 0rpx 0rpx;
			background: $uni-bg-color;
			position: relative;

			.money-warp {
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
			}

			.theme {
				font-size: 22rpx;
				color: rgba(0, 0, 0, 0.6);
				margin-top: 18rpx;
			}

			.theme-text {
				font-size: 42rpx;
			}

			.theme-text2 {
				font-size: 42rpx;
				color: rgb(254, 64, 76);
			}
		}

		.content {
			.pay {
				color: rgb(102, 102, 102);
				letter-spacing: 1rpx;
				font-size: 26rpx;
				margin-right: 14rpx;
			}

			.income-type {
				color: rgb(34, 34, 34);
				font-family: Roboto;
				font-size: 28rpx;
				letter-spacing: 1rpx;
				// margin-left: 100rpx;
			}

			.pie {
				margin: 0rpx 24rpx 35rpx 24rpx;
				border-radius: 0rpx 0rpx 26rpx 26rpx;
				background: $uni-bg-color;
				position: relative;
				display: flex;
				justify-content: center;
				align-items: center;
				text-align: center;
				// padding: 0rpx 30rpx 30rpx 30rpx;
			}


			.total {
				display: flex;
				justify-content: center;
				align-items: center;
				font-size: 28rpx;
				color: rgb(102, 102, 102);
			}

			.grid-title {
				color: #6072FF;
				font-size: 30rpx;
				letter-spacing: 1rpx;
			}

			.grid-text {
				padding: 10rpx 0rpx 0rpx 0rpx;
				color: #6072FF;
				font-size: 26rpx;
				letter-spacing: 1rpx;
			}

			.module {
				margin: 0rpx 24rpx 35rpx 24rpx;
				border-radius: 26rpx;
				background: $uni-bg-color;
				position: relative;

				.piece {
					width: 14rpx;
					height: 14rpx;
					margin-right: 8rpx;
				}


				.more {
					color: rgb(153, 153, 153);
					font-size: 26rpx;
					letter-spacing: 1rpx;
				}

				.top {
					color: rgb(0, 0, 0);
					font-size: 28rpx;
					letter-spacing: 1rpx;
				}

				.title {
					color: rgb(102, 102, 102);
					padding: 16rpx 20rpx;
					font-size: 24rpx;
					letter-spacing: 1rpx;
				}

				.title-flex-end {
					display: flex;
					justify-content: flex-end;
				}

				.stats-number-bg {
					display: flex;
					// justify-content: space-between;
					flex: 1;
					padding: 16rpx 20rpx;
					background: linear-gradient(270.00deg, rgb(232, 239, 255) 0%, rgb(250, 251, 255) 100%);
					border-radius: 12rpx;
					color: rgb(34, 34, 34);
					font-family: Roboto;
					font-size: 28rpx;
					font-weight: 500;
					letter-spacing: 1rpx;
				}

				.header-tips {
					padding: 0 33rpx;
					display: flex;
					justify-content: space-between;
					align-items: center;

					.date {
						display: flex;
						padding-top: 30rpx;
						font-size: 26rpx;
						align-items: center;
						color: #222222;
					}

					.header-tips-icon {
						padding: 30rpx 0 0 0;
					}
				}

				.content {
					padding: 30rpx;
				}

				.details-row {
					padding: 40rpx 40rpx 0 40rpx;

					text {
						margin-left: 20rpx;
					}
				}

				.details-data {
					padding: 0 40rpx 30rpx 40rpx;
				}
			}
		}
	}

	.filter-criteria-box {
		display: flex;
		margin-top: 50rpx;
		padding: 0 80rpx;
		justify-content: space-between;
		color: #FFFFFF;
		font-size: 26rpx;
		font-weight: 700;
		margin-bottom: 35rpx;

		.filter-criteria {
			display: flex;
			align-items: baseline;

		}
	}

	.date-picker-box {
		display: flex;
		justify-content: space-between;
		padding: 0 30rpx;
		margin-top: 25rpx;
		color: #FFFFFF;
		font-size: 26rpx;
	}
</style>
